<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>11111</title>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
<div id = "app">
 <p style = "font-size:25px;"> {{ counter }}</p>
 <button @click = "counter++" style = "font-size:25px;">点我</button>
</div>
<script type = "text/javascript">
 var vm = new Vue({
    el: '#app',
    data: {
       counter: 1 //必须用counter因为是计数器
    }
 });
vm.$watch('counter',function(nval, oval){
	alert('监听之前的'+nval+'监听之后的'+oval)
	
})
</script>
</body>
</html>